<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:include="/common/commonHead :: commonHead('在线用户')"></head>
<body>
<div th:replace="/common/titleNav :: titleNavDiv"></div>
<div class="content" th:with="oneMenu='2',twoMenu='6'">
	<div th:replace="/common/sidebarNav :: sidebarDiv"></div>
		<div class="main">
			<div class="right">
				<div class="title">
					<a class="btn btn-primary" href="javascript:void(0);" id="btnForceLogout">终止会话</a>
					<a class="btn btn-default border-blue" href="javascript:void(0);" id="btnRefresh">刷新</a>
					<a class="btn btn-primary" href="javascript:void(0);" data-toggle="modal" data-target="#sendEmail">群发通知</a>
				</div>
				<form th:action="@{/sessions/list}" method="post" id="queryForm">
					<input type="hidden" name="page" th:value="${page}"/>
					<input type="hidden" name="rows" th:value="${rows}"/>
					<table class="table table-form">
						<thead>
						<tr>
							<td width="8%"></td>
							<td width="22%"></td>
							<td width="8%"></td>
							<td width="22%"></td>
							<td width="8%"></td>
							<td width="22%"></td>
						</tr>
						</thead>
						<tbody>
						<tr>
							<td align="right"><span class="form-label">登录账号:</span></td>
							<td>
								<input type="text" class="form-control" placeholder="请输入" name="loginId" th:value="${loginId}">
							</td>
							<td align="right"><span class="form-label">姓名:</span></td>
							<td>
								<input type="text" class="form-control" placeholder="请输入"  name="userName" th:value="${userName}">
							</td>
							<td align="right"><span class="form-label">主机地址:</span></td>
							<td>
								<input type="text" class="form-control" placeholder="请输入"  name="host" th:value="${host}">
							</td>
						</tr>
						<tr>
							<td align="right"><span class="form-label">部门名称:</span></td>
							<td colspan="5">
								<input type="text" class="form-control" placeholder="请输入" name="deptName" th:value="${deptName}">
							</td>
						</tr>
						<tr>
							<td>&nbsp;</td>
							<td colspan="5">
								<a href="javascript:void(0);" class="btn btn-primary" id="btnQuery">查询</a>
								<a href="javascript:void(0);" class="btn btn-default border-blue" style="margin-left:15px;" id="btnReset">清空</a>
							</td>
						</tr>
						</tbody>
					</table>
				</form>
				<div style="overflow-x:auto; padding: 0 5px;">
					<table class="table table-bordered table-striped table-condensed table-hover"
						   style="table-layout: fixed;" name="resizableTable"  id="sessionTable">
						<thead>
						<tr>
							<th width="5%" style="text-align: center;"><input type="checkbox" id="checkBoxAll"/></th>
							<th width="10%">会话id</th>
							<th width="10%">用户名</th>
							<th width="30%">部门名称</th>
							<th width="10%">主机地址</th>
							<th width="15%">开始时间</th>
							<th width="15%">最后访问时间</th>
							<th width="5%">状态</th>
						</tr>
						</thead>
						<tbody>
							<tr th:each="entry : ${list}">
								<td style="text-align: center;"><input type="checkbox" /></td>
								<td th:title="${entry.id}" th:text="${entry.id}"></td>
								<td th:title="${entry.userInfo}" th:text="${entry.userInfo}"></td>
								<td th:title="${entry.deptName}" th:text="${entry.deptName}"></td>
								<td th:title="${entry.host}" th:text="${entry.host}"></td>
								<td th:title="${entry.startTime}" th:text="${entry.startTime}"></td>
								<td th:title="${entry.lastAccessTime}" th:text="${entry.lastAccessTime}"></td>
								<td th:title="${entry.forceLogout}" th:text="${entry.forceLogout}"></td>
							</tr>
						</tbody>
					</table>
				</div>
				<ul class="pagination" id="pagination"></ul>
				<div class="page-msg">共<span th:text="${total}"></span>记录</div>
			</div>
		</div>
	</div>
	</div>

	<!-- 刷新的form -->
	<form th:action="@{/sessions/list}" method="post" id="refreshForm">
	</form>
	
	<!-- 强制踢出的form -->
	<form th:action="@{/sessions/forceLogout}" method="post" id="forceLogoutForm">
		<input type= "hidden" id = "ids" name="sessionIds"/>
	</form>
	<input type="hidden" th:value="${total}" id="totalValue">
	<!-- 模态框（Modal） -->
	<div class="modal fade" id="sendEmail" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	    <div class="modal-dialog" style="width: 800px;">
	       <div class="modal-content">
	          <div class="modal-header">
	             <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
	             <h4 class="modal-title" id="myModalLabel">编辑邮件</h4>
	          </div>
	          <div class="modal-body" style="padding-right:0px;padding-top:5px">
	          	<form th:action="@{/sessions/sendEmail}" method="post" id="noticeForm">
	          		<div style="margin-bottom:15px">
		          		<label>邮件主题：</label>
			          	<input id="title" name="title" style="width:750px;height:30px"/>
			          	<input id="titleLengthTip"  readonly="readonly" type="text" class="counter" size="4" maxlength="4" defaultValue="50" value="50" tabindex="-1" style="visibility: hidden;color:#8f1313;font-size: 10px; border: none;width: 30px;">
		          	</div><br>
	          		<div style="margin-bottom:15px">
		          		<label>邮件内容：</label>
			          	<textarea style="width:750px;height:150px" id="content" name="content"></textarea>
			          	<input id="contentLengthTip" readonly="readonly" type="text" class="counter" size="4" maxlength="4" defaultValue="200" value="200" tabindex="-1" style="visibility: hidden;color:#8f1313;font-size: 10px; border: none;width: 30px;">
		          	</div>
	          	</form>
	          </div>
	          <div class="modal-footer">
	             <button type="button" class="btn btn-primary" id="saveEmail">确定</button>
	             <button type="button" class="btn btn-default border-blue" data-dismiss="modal">取消</button>
	          </div>
	       </div><!-- /.modal-content -->
	    </div><!-- /.modal-dialog -->
	</div><!-- /.modal -->

	<script type="text/javascript" th:src="@{/static/javascript/admin/sessions/list.js}"></script>
	</body>
</html>